<%--
  Created by IntelliJ IDEA.
  User: 86134
  Date: 2024/10/11
  Time: 9:49
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="service.MembersInfoService" %>
<%@ page import="entity.MembersInfo" %>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>更新</title>
    <style>
        body {
            font-family: Arial, sans-serif;
        }
        form {
            margin: 20px;
        }
        label, input {
            display: block;
            margin-bottom: 10px;
        }
    </style>
</head>
<body>
    <h1>更新</h1>
    <%
        int id = Integer.parseInt(request.getParameter("id"));
        MembersInfoService membersInfoService = new MembersInfoService();
        MembersInfo member = null;
        try {
            member = membersInfoService.getMemberById(id);
        } catch (Exception e) {
            e.printStackTrace();
            return;
        }

        if (member == null) {
            return;
        }
    %>

    <form action="MembersInfoServlet" method="post">
        <input type="hidden" name="id" value="<%= member.getMid() %>">
        <label for="mname">名字:</label>
        <input type="text" id="mname" name="mname" value="<%= member.getMname() %>">

        <label for="mgender">性别:</label>
        <input type="text" id="mgender" name="mgender" value="<%= member.getMgender() %>">

        <label for="mage">年龄:</label>
        <input type="number" id="mage" name="mage" value="<%= member.getMage() %>">

        <label for="maddress">城市:</label>
        <input type="text" id="maddress" name="maddress" value="<%= member.getMaddress() %>">

        <label for="memail">Email:</label>
        <input type="email" id="memail" name="memail" value="<%= member.getMemail() %>">

        <input type="hidden" name="method" value="update">
        <input type="submit" value="更新">
    </form>
</body>
</html>

